import React from 'react'
import { connect } from 'react-redux'
import { HashRouter, Route, Routes } from 'react-router-dom'
import './app.css'
import Layouts from './layouts/index.jsx'
import routes from './router/index.js'
import './style/custom-theme.less'

const App = () => {
  return (
    <HashRouter>
      <Layouts>
        <Routes>
          {routes.map((route) => {
            return (
              <Route
                key={route.path}
                path={route.path}
                element={route.component}
              />
            )
          })}
        </Routes>
      </Layouts>
    </HashRouter>
  )
}

const mapStateToProps = (state) => ({
  user: state.user,
})

export default connect(mapStateToProps)(App)
